<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>账号列表</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>

<body>
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;">
        <legend>管理员管理</legend>
        <div>
            <button type="button" class="layui-btn btn-add">添加</button>
            <button type="button" class="layui-btn layui-btn-danger btn-delete">删除</button>
        </div>
    </fieldset>

    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="200">
            <col>
        </colgroup>
        <thead>
            <tr>
                <th>id</th>
                <th>用户名</th>
                <th>角色</th>
                <th>真实姓名</th>
                <th>创建时间</th>
                <th>最后登录时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($list as $item)
                <tr>
                    <td>{{ $item['id'] }}</td>
                    <td>{{ $item['username'] }}</td>
                    <td>{{ $item['role_name'] }}</td>
                    <td>{{ $item['real_name'] }}</td>
                    <td>{{ date('Y-m-d H:i:s', strtotime($item['add_time'])) }}</td>
                    <td>{{ date('Y-m-d H:i:s', strtotime($item['lastlogin'])) }}</td>
                    <td>{{ $item['status'] == 0 ? '正常' : '禁用' }}</td>
                    <td>
                        <bttton class="layui-btn layui-btn-xs">修改</bttton>
                        <bttton class="layui-btn layui-btn-danger layui-btn-xs">删除</bttton>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</body>
<script src="/layui/layui.js"></script>
<script>
    layui.use(['element', 'layer'], function() {
        $ = layui.jquery;
        var element = layui.element;
        var layer = layui.layer;

    });
    document.querySelector(".btn-add").onclick = function() {
        layer.open({
            type: 2,
            title: '增加管理员',
            shadeClose: true,
            shade: 0.8,
            area: ['480px', '500px'],
            content: '/admins/admin/add' //iframe的url
        });
    }

</script>

</html>
